-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add AutoLayout constraints to make inline messages visible in UIKit app #718
Conversation
Sample app builds 📱Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.
|
d783dc5
to
84e6c73
Compare
f506cd0
to
cc11137
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storyboard modified because I added inline Views to the screen.
I have been talking with Jason on how to QA test this feature. He didn't have specific requirements as far as what screen these Views go, so I added to Dashboard for convenience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added 2 inline Views to the Dashboard screen. So we can test customers can use storyboards or use code to add inline Views to their app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because queue manager stores data in-memory, I had to make it a singleton. All changes in this commit are to make it a singleton.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main logic of this PR - AutoLayout constraints so messages show up on screen.
cc11137
to
4a32afa
Compare
84e6c73
to
90ed722
Compare
@@ -8,8 +8,11 @@ protocol GistInstance: AutoMockable { | |||
} | |||
|
|||
public class Gist: GistInstance, GistDelegate { | |||
var messageQueueManager: MessageQueueManager = DIGraphShared.shared.messageQueueManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed because MessageQueueManager
is a singleton now. Use a property getter to get the shared singleton instance.
@@ -15,8 +16,9 @@ protocol MessageQueueManager: AutoMockable { | |||
} | |||
|
|||
// sourcery: InjectRegisterShared = "MessageQueueManager" | |||
// sourcery: InjectSingleton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class has always been used as a singleton. The whole SDK would use Gist.messageQueue
. To make the code testable, I switched to instead make the class a singleton in the digraph as we do for all other code in the SDK.
@@ -3,7 +3,8 @@ import Foundation | |||
import UIKit | |||
|
|||
protocol MessageQueueManager: AutoMockable { | |||
var interval: Double { get set } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I do prefer to use property getter/setters for an API, I found this API to be safer with having the class be a singleton.
Here is some sample code with what I mean:
// If you use a property getter/setter API:
let queueManager: MessageQueueManager = ... get singleton instance
queueManager.interval = 500
// 🤔 Did we update the shared singleton `inventory` property? Or did we update the `queueManager` local variable, only?
// if we change to getter/setter functions:
MessageQueueManager.singletonInstance.setInventory(500)
// This is much more clear that we are editing the singleton, not a locally scoped instance.
90ed722
to
27f8be8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added autolayout code to the View so we can now display the web content in the View.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature-inline-inapp #718 +/- ##
=======================================================
Coverage ? 58.54%
=======================================================
Files ? 142
Lines ? 3983
Branches ? 0
=======================================================
Hits ? 2332
Misses ? 1651
Partials ? 0 ☔ View full report in Codecov by Sentry. |
SDK binary size reports 📊SDK binary size of this PR
SDK binary size diff report between this PR and the main branch
|
ebabee3
to
4d63f69
Compare
27f8be8
to
e79e89c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very UI heavy code. A small video showing how it looks like and what have been tested would make the code review much easier.
5458040
to
5581d89
Compare
183e553
to
aeaaabe
Compare
Video added to description of PR. |
Part of: https://linear.app/customerio/issue/MBL-310/create-a-uikit-uiview-that-displays-an-inline-in-app-message-sent-from Create a WebView to display inline in-app message and display in the Inline UIView. To do this, we can re-use a lot of the same logic that Modal messages use to create WebViews and display them. Testing: There are some automated tests added in this commit. Reviewer notes: This commit will not show an in-app message if you were to add it to a sample app. Autolayout constraints need to be added to have Views resize and that will come in a future commit. commit-id:025c7bf5
5581d89
to
f0c5d97
Compare
…UIKit app Part of: https://linear.app/customerio/issue/MBL-310/create-a-uikit-uiview-that-displays-an-inline-in-app-message-sent-from This commit implements UIKit AutoLayout constraints to the Inline View and the WebView. Adding these constraints make inline messages visible inside of UIKit apps! The Inline View will start at height 0 and then after the webview content is loaded, it will instantly change the height to display the full in-app message. Testing: All testing is done manually in sample apps. AutoLayout constraints change the visuals of Views so viewing how the View looks in an app is required to test. If you want to test this commit in a sample app build, follow these instructions: * Open the UIKit app on device. * Immediately after the app opens, send yourself a test in-app message with element ID "test". * Wait 10 seconds. In this time, the in-app SDK will fetch the test in-app message and then will display it inline on the screen. commit-id:5ab2c403
aeaaabe
to
1c38f27
Compare
Part of: https://linear.app/customerio/issue/MBL-310/create-a-uikit-uiview-that-displays-an-inline-in-app-message-sent-from
This commit implements UIKit AutoLayout constraints to the Inline View and the WebView. Adding these constraints make inline messages visible inside of UIKit apps! The Inline View will start at height 0 and then after the webview content is loaded, it will instantly change the height to display the full in-app message.
Testing:
All testing is done manually in sample apps. AutoLayout constraints change the visuals of Views so viewing how the View looks in an app is required to test.
If you want to test this commit in a sample app build, follow these instructions:
Demo video showing this testing:
When I began recording the video, I had already sent 2 messages from Fly to my test device. That way when the app opens and fetches messages, it would find these 2 messages. Then, the app displays those 2 messages in 2 separate inline Views on the screen. The 2 inline Views are expected to display all of the content with the correct height and width to match the web content's aspect ratio.
demo.mov
Stack: